import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '创建时间',
    align:"center",
    dataIndex: 'createTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '单据类型',
    align:"center",
    dataIndex: 'billTypeName'
   },
   {
    title: '订单编号',
    align:"center",
    dataIndex: 'orderId'
   },
   {
    title: '订单编号',
    align:"center",
    dataIndex: 'orderReference'
   },
   {
    title: '订单交期',
    align:"center",
    dataIndex: 'orderDeliveryDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '产品名称',
    align:"center",
    dataIndex: 'productId'
   },
   {
    title: '产品编码',
    align:"center",
    dataIndex: 'productCode'
   },
   {
    title: '产品名称',
    align:"center",
    dataIndex: 'productName'
   },
   {
    title: '组件编码',
    align:"center",
    dataIndex: 'componentId'
   },
   {
    title: '组件编码',
    align:"center",
    dataIndex: 'componentCoding'
   },
   {
    title: '组件名称',
    align:"center",
    dataIndex: 'componentName'
   },
   {
    title: '组件属性',
    align:"center",
    dataIndex: 'componentAttribute'
   },
   {
    title: '匹配单号',
    align:"center",
    dataIndex: 'matchingOrderNumber'
   },
   {
    title: '需求数量',
    align:"center",
    dataIndex: 'quantityRequired'
   },
   {
    title: '库存',
    align:"center",
    dataIndex: 'inventory'
   },
   {
    title: '请购数量',
    align:"center",
    dataIndex: 'requisitionedQuantity'
   },
   {
    title: '安全库存',
    align:"center",
    dataIndex: 'safeStock'
   },
   {
    title: '匹配数量',
    align:"center",
    dataIndex: 'numberMatches'
   },
   {
    title: '齐套日期',
    align:"center",
    dataIndex: 'setDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '齐套标志',// 0否 1是
    align:"center",
    dataIndex: 'setMark',
    customRender: ({ text }) => {
      return text === 1 ? "是" : text === 0 ? '否' : ''
    },
   },
   {
    title: '第三方编码',
    align:"center",
    dataIndex: 'thirdPartyCode',
    ifShow: false
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'remark'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [{
    label: "分析内容",
    field: 'fxNeiRong',
    component: 'Input',
    slot: 'form-fxNeiRong',
    colProps: {
      span: 6
    },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '单据类型',
    field: 'billTypeName',
    component: 'Input',
    slot:'billTypeSlot',
    dynamicRules: () => {
      return [
        { required: true, message: '请选择单据类型!' },
      ];
    },
  },
  {
    label: '订单编号',
    field: 'orderId',
    component: 'Input',
  },
  {
    label: '订单编号',
    field: 'orderReference',
    component: 'Input',
  },
  {
    label: '订单交期',
    field: 'orderDeliveryDate',
    component: 'DatePicker',
  },
  {
    label: '产品名称',
    field: 'productId',
    component: 'Input',
  },
  {
    label: '产品编码',
    field: 'productCode',
    component: 'Input',
  },
  {
    label: '产品名称',
    field: 'productName',
    component: 'Input',
  },
  {
    label: '组件编码',
    field: 'componentId',
    component: 'Input',
  },
  {
    label: '组件编码',
    field: 'componentCoding',
    component: 'Input',
  },
  {
    label: '组件名称',
    field: 'componentName',
    component: 'Input',
  },
  {
    label: '组件属性',
    field: 'componentAttribute',
    component: 'Input',
  },
  {
    label: '匹配单号',
    field: 'matchingOrderNumber',
    component: 'Input',
  },
  {
    label: '需求数量',
    field: 'quantityRequired',
    component: 'InputNumber',
  },
  {
    label: '库存',
    field: 'inventory',
    component: 'InputNumber',
  },
  {
    label: '请购数量',
    field: 'requisitionedQuantity',
    component: 'InputNumber',
  },
  {
    label: '安全库存',
    field: 'safeStock',
    component: 'InputNumber',
  },
  {
    label: '匹配数量',
    field: 'numberMatches',
    component: 'InputNumber',
  },
  {
    label: '齐套日期',
    field: 'setDate',
    component: 'DatePicker',
  },
  {
    label: '齐套标志',// 0否 1是
    field: 'setMark',
    component: 'Select',
    defaultValue: 0,
    componentProps: {
      options: [
        { value: 0, label: '否' },
        { value: 1, label: '是' },
      ],
      stringToNumber: true,
    }
  },
  {
    label: '创建时间',
    field: 'createTime',
    component: 'DatePicker',
  },
  {
    label: '第三方编码',
    field: 'thirdPartyCode',
    component: 'Input',
    ifShow: false
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}